package com.lizardmind.haofudoctor.ui.studio.signFamily

import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import android.view.View
import com.linxiao.framework.activity.BaseActivity
import com.linxiao.framework.adapter.BaseAdapter
import com.linxiao.framework.util.getDataBinding
import com.linxiao.framework.util.toasts
import com.lizardmind.haofudoctor.R
import com.lizardmind.haofudoctor.databinding.ActivitySimpleListBinding
import com.lizardmind.haofudoctor.databinding.ItemAllFamilyMomentBinding
import com.lizardmind.haofudoctor.other.SignFamilyBean
import kotlinx.android.synthetic.main.activity_simple_list.*
import kotlinx.android.synthetic.main.include_title_text.*
import org.jetbrains.anko.sdk25.coroutines.onClick

/**
 * Created by Administrator on 2017/12/20.
 * 全部家庭成员
 */
class AllFamilyMomentActivity:BaseActivity() {

    private val list= arrayListOf(
            SignFamilyBean("1","aaa","刘雯",2,"四川成都",3,tag = "户主",birthday = "1970-10-10"),
            SignFamilyBean("2","aaa","张伟",1,"四川成都",3,tag = "父亲",birthday = "1970-10-10"),
            SignFamilyBean("3","aaa","刘美丽",2,"四川成都",3,tag = "女儿",birthday = "1970-10-10")
    )

    val adapter by lazy { BaseAdapter<SignFamilyBean,ItemAllFamilyMomentBinding>(R.layout.item_all_family_moment,list) }
    val binding by lazy { getDataBinding<ActivitySimpleListBinding>(R.layout.activity_simple_list) }
    override fun onCreatRootView(): View? {
        return binding.root
    }

    override fun onInitView(savedInstanceState: Bundle?) {
        imgLeft.setImageResource(R.mipmap.back)
        imgLeft.onClick { finish() }
        titleText.text="全部成员"

        recyclerView.layoutManager= LinearLayoutManager(this)
        recyclerView.adapter=adapter
        adapter.onBind { itemBingding, position, data ->
            itemBingding.rLayout.onClick {
                toasts("开发中...")
            }
        }
    }
}